\(\int \frac {(c+d \sin (e+f x))^2}{3+3 \sin (e+f x)} \, dx\) [455]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 25, antiderivative size = 60 \[ \int \frac {(c+d \sin (e+f x))^2}{3+3 \sin (e+f x)} \, dx=\frac {1}{3} (2 c-d) d x-\frac {d^2 \cos (e+f x)}{3 f}-\frac {(c-d)^2 \cos (e+f x)}{3 f (1+\sin (e+f x))} \]

[Out]

(2*c-d)*d*x/a-d^2*cos(f*x+e)/a/f-(c-d)^2*cos(f*x+e)/a/f/(1+sin(f*x+e))

Rubi [A] (verified)

Time = 0.10 (sec) , antiderivative size = 62, normalized size of antiderivative = 1.03, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.120, Rules used = {2825, 2814, 2727} \[ \int \frac {(c+d \sin (e+f x))^2}{3+3 \sin (e+f x)} \, dx=-\frac {(c-d)^2 \cos (e+f x)}{a f (\sin (e+f x)+1)}+\frac {d x (2 c-d)}{a}-\frac {d^2 \cos (e+f x)}{a f} \]

[In]

Int[(c + d*Sin[e + f*x])^2/(a + a*Sin[e + f*x]),x]

[Out]

((2*c - d)*d*x)/a - (d^2*Cos[e + f*x])/(a*f) - ((c - d)^2*Cos[e + f*x])/(a*f*(1 + Sin[e + f*x]))

Rule 2727

Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> Simp[-Cos[c + d*x]/(d*(b + a*Sin[c + d*x])), x]
/; FreeQ[{a, b, c, d}, x] && EqQ[a^2 - b^2, 0]

Rule 2814

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[b*(x/d)
, x] - Dist[(b*c - a*d)/d, Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d
, 0]

Rule 2825

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^2/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(-b^2
)*(Cos[e + f*x]/(d*f)), x] + Dist[1/d, Int[Simp[a^2*d - b*(b*c - 2*a*d)*Sin[e + f*x], x]/(c + d*Sin[e + f*x]),
 x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]

Rubi steps \begin{align*} \text {integral}& = -\frac {d^2 \cos (e+f x)}{a f}+\frac {\int \frac {a c^2+a (2 c-d) d \sin (e+f x)}{a+a \sin (e+f x)} \, dx}{a} \\ & = \frac {(2 c-d) d x}{a}-\frac {d^2 \cos (e+f x)}{a f}+(c-d)^2 \int \frac {1}{a+a \sin (e+f x)} \, dx \\ & = \frac {(2 c-d) d x}{a}-\frac {d^2 \cos (e+f x)}{a f}-\frac {(c-d)^2 \cos (e+f x)}{f (a+a \sin (e+f x))} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(121\) vs. \(2(60)=120\).

Time = 0.38 (sec) , antiderivative size = 121, normalized size of antiderivative = 2.02 \[ \int \frac {(c+d \sin (e+f x))^2}{3+3 \sin (e+f x)} \, dx=-\frac {\left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right ) \left (d \cos \left (\frac {1}{2} (e+f x)\right ) (-((2 c-d) (e+f x))+d \cos (e+f x))+\left (-2 c^2-2 c d (-2+e+f x)+d^2 (-2+e+f x)+d^2 \cos (e+f x)\right ) \sin \left (\frac {1}{2} (e+f x)\right )\right )}{3 f (1+\sin (e+f x))} \]

[In]

Integrate[(c + d*Sin[e + f*x])^2/(3 + 3*Sin[e + f*x]),x]

[Out]

-1/3*((Cos[(e + f*x)/2] + Sin[(e + f*x)/2])*(d*Cos[(e + f*x)/2]*(-((2*c - d)*(e + f*x)) + d*Cos[e + f*x]) + (-
2*c^2 - 2*c*d*(-2 + e + f*x) + d^2*(-2 + e + f*x) + d^2*Cos[e + f*x])*Sin[(e + f*x)/2]))/(f*(1 + Sin[e + f*x])
)

Maple [A] (verified)

Time = 0.78 (sec) , antiderivative size = 75, normalized size of antiderivative = 1.25

method result size
derivativedivides \(\frac {-\frac {2 \left (c^{2}-2 c d +d^{2}\right )}{\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1}+2 d \left (-\frac {d}{1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )}+\left (2 c -d \right ) \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )\right )}{f a}\) \(75\)
default \(\frac {-\frac {2 \left (c^{2}-2 c d +d^{2}\right )}{\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1}+2 d \left (-\frac {d}{1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )}+\left (2 c -d \right ) \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )\right )}{f a}\) \(75\)
parallelrisch \(\frac {4 \left (\left (f x -\frac {3}{2}\right ) d +c \right ) \left (c -\frac {d}{2}\right ) \sin \left (\frac {f x}{2}+\frac {e}{2}\right )-\left (\left (-4 f x c +2 d x f +3 d \right ) \cos \left (\frac {f x}{2}+\frac {e}{2}\right )+d \left (\sin \left (\frac {3 f x}{2}+\frac {3 e}{2}\right )+\cos \left (\frac {3 f x}{2}+\frac {3 e}{2}\right )\right )\right ) d}{2 \left (\sin \left (\frac {f x}{2}+\frac {e}{2}\right )+\cos \left (\frac {f x}{2}+\frac {e}{2}\right )\right ) a f}\) \(105\)
risch \(\frac {2 d x c}{a}-\frac {d^{2} x}{a}-\frac {d^{2} {\mathrm e}^{i \left (f x +e \right )}}{2 a f}-\frac {d^{2} {\mathrm e}^{-i \left (f x +e \right )}}{2 a f}-\frac {2 c^{2}}{f a \left ({\mathrm e}^{i \left (f x +e \right )}+i\right )}+\frac {4 c d}{f a \left ({\mathrm e}^{i \left (f x +e \right )}+i\right )}-\frac {2 d^{2}}{f a \left ({\mathrm e}^{i \left (f x +e \right )}+i\right )}\) \(133\)
norman \(\frac {\frac {-2 c^{2}+4 c d -4 d^{2}}{f a}+\frac {\left (2 c -d \right ) d x}{a}-\frac {2 d^{2} \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{f a}+\frac {\left (-2 c^{2}+4 c d -2 d^{2}\right ) \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f a}+\frac {\left (2 c -d \right ) d x \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{a}+\frac {\left (2 c -d \right ) d x \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{a}+\frac {\left (2 c -d \right ) d x \left (\tan ^{5}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{a}-\frac {2 d^{2} \left (\tan ^{3}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f a}+\frac {2 \left (-2 c^{2}+4 c d -3 d^{2}\right ) \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f a}+\frac {2 \left (2 c -d \right ) d x \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{a}+\frac {2 \left (2 c -d \right ) d x \left (\tan ^{3}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{a}}{\left (1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )^{2} \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )}\) \(295\)

[In]

int((c+d*sin(f*x+e))^2/(a+a*sin(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

2/f/a*(-(c^2-2*c*d+d^2)/(tan(1/2*f*x+1/2*e)+1)+d*(-d/(1+tan(1/2*f*x+1/2*e)^2)+(2*c-d)*arctan(tan(1/2*f*x+1/2*e
))))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 142 vs. \(2 (62) = 124\).

Time = 0.26 (sec) , antiderivative size = 142, normalized size of antiderivative = 2.37 \[ \int \frac {(c+d \sin (e+f x))^2}{3+3 \sin (e+f x)} \, dx=-\frac {d^{2} \cos \left (f x + e\right )^{2} - {\left (2 \, c d - d^{2}\right )} f x + c^{2} - 2 \, c d + d^{2} - {\left ({\left (2 \, c d - d^{2}\right )} f x - c^{2} + 2 \, c d - 2 \, d^{2}\right )} \cos \left (f x + e\right ) - {\left ({\left (2 \, c d - d^{2}\right )} f x - d^{2} \cos \left (f x + e\right ) + c^{2} - 2 \, c d + d^{2}\right )} \sin \left (f x + e\right )}{a f \cos \left (f x + e\right ) + a f \sin \left (f x + e\right ) + a f} \]

[In]

integrate((c+d*sin(f*x+e))^2/(a+a*sin(f*x+e)),x, algorithm="fricas")

[Out]

-(d^2*cos(f*x + e)^2 - (2*c*d - d^2)*f*x + c^2 - 2*c*d + d^2 - ((2*c*d - d^2)*f*x - c^2 + 2*c*d - 2*d^2)*cos(f
*x + e) - ((2*c*d - d^2)*f*x - d^2*cos(f*x + e) + c^2 - 2*c*d + d^2)*sin(f*x + e))/(a*f*cos(f*x + e) + a*f*sin
(f*x + e) + a*f)

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 940 vs. \(2 (46) = 92\).

Time = 1.12 (sec) , antiderivative size = 940, normalized size of antiderivative = 15.67 \[ \int \frac {(c+d \sin (e+f x))^2}{3+3 \sin (e+f x)} \, dx=\text {Too large to display} \]

[In]

integrate((c+d*sin(f*x+e))**2/(a+a*sin(f*x+e)),x)

[Out]

Piecewise((-2*c**2*tan(e/2 + f*x/2)**2/(a*f*tan(e/2 + f*x/2)**3 + a*f*tan(e/2 + f*x/2)**2 + a*f*tan(e/2 + f*x/
2) + a*f) - 2*c**2/(a*f*tan(e/2 + f*x/2)**3 + a*f*tan(e/2 + f*x/2)**2 + a*f*tan(e/2 + f*x/2) + a*f) + 2*c*d*f*
x*tan(e/2 + f*x/2)**3/(a*f*tan(e/2 + f*x/2)**3 + a*f*tan(e/2 + f*x/2)**2 + a*f*tan(e/2 + f*x/2) + a*f) + 2*c*d
*f*x*tan(e/2 + f*x/2)**2/(a*f*tan(e/2 + f*x/2)**3 + a*f*tan(e/2 + f*x/2)**2 + a*f*tan(e/2 + f*x/2) + a*f) + 2*
c*d*f*x*tan(e/2 + f*x/2)/(a*f*tan(e/2 + f*x/2)**3 + a*f*tan(e/2 + f*x/2)**2 + a*f*tan(e/2 + f*x/2) + a*f) + 2*
c*d*f*x/(a*f*tan(e/2 + f*x/2)**3 + a*f*tan(e/2 + f*x/2)**2 + a*f*tan(e/2 + f*x/2) + a*f) + 4*c*d*tan(e/2 + f*x
/2)**2/(a*f*tan(e/2 + f*x/2)**3 + a*f*tan(e/2 + f*x/2)**2 + a*f*tan(e/2 + f*x/2) + a*f) + 4*c*d/(a*f*tan(e/2 +
 f*x/2)**3 + a*f*tan(e/2 + f*x/2)**2 + a*f*tan(e/2 + f*x/2) + a*f) - d**2*f*x*tan(e/2 + f*x/2)**3/(a*f*tan(e/2
 + f*x/2)**3 + a*f*tan(e/2 + f*x/2)**2 + a*f*tan(e/2 + f*x/2) + a*f) - d**2*f*x*tan(e/2 + f*x/2)**2/(a*f*tan(e
/2 + f*x/2)**3 + a*f*tan(e/2 + f*x/2)**2 + a*f*tan(e/2 + f*x/2) + a*f) - d**2*f*x*tan(e/2 + f*x/2)/(a*f*tan(e/
2 + f*x/2)**3 + a*f*tan(e/2 + f*x/2)**2 + a*f*tan(e/2 + f*x/2) + a*f) - d**2*f*x/(a*f*tan(e/2 + f*x/2)**3 + a*
f*tan(e/2 + f*x/2)**2 + a*f*tan(e/2 + f*x/2) + a*f) - 2*d**2*tan(e/2 + f*x/2)**2/(a*f*tan(e/2 + f*x/2)**3 + a*
f*tan(e/2 + f*x/2)**2 + a*f*tan(e/2 + f*x/2) + a*f) - 2*d**2*tan(e/2 + f*x/2)/(a*f*tan(e/2 + f*x/2)**3 + a*f*t
an(e/2 + f*x/2)**2 + a*f*tan(e/2 + f*x/2) + a*f) - 4*d**2/(a*f*tan(e/2 + f*x/2)**3 + a*f*tan(e/2 + f*x/2)**2 +
 a*f*tan(e/2 + f*x/2) + a*f), Ne(f, 0)), (x*(c + d*sin(e))**2/(a*sin(e) + a), True))

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 209 vs. \(2 (62) = 124\).

Time = 0.29 (sec) , antiderivative size = 209, normalized size of antiderivative = 3.48 \[ \int \frac {(c+d \sin (e+f x))^2}{3+3 \sin (e+f x)} \, dx=-\frac {2 \, {\left (d^{2} {\left (\frac {\frac {\sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} + \frac {\sin \left (f x + e\right )^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + 2}{a + \frac {a \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} + \frac {a \sin \left (f x + e\right )^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {a \sin \left (f x + e\right )^{3}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{3}}} + \frac {\arctan \left (\frac {\sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1}\right )}{a}\right )} - 2 \, c d {\left (\frac {\arctan \left (\frac {\sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1}\right )}{a} + \frac {1}{a + \frac {a \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1}}\right )} + \frac {c^{2}}{a + \frac {a \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1}}\right )}}{f} \]

[In]

integrate((c+d*sin(f*x+e))^2/(a+a*sin(f*x+e)),x, algorithm="maxima")

[Out]

-2*(d^2*((sin(f*x + e)/(cos(f*x + e) + 1) + sin(f*x + e)^2/(cos(f*x + e) + 1)^2 + 2)/(a + a*sin(f*x + e)/(cos(
f*x + e) + 1) + a*sin(f*x + e)^2/(cos(f*x + e) + 1)^2 + a*sin(f*x + e)^3/(cos(f*x + e) + 1)^3) + arctan(sin(f*
x + e)/(cos(f*x + e) + 1))/a) - 2*c*d*(arctan(sin(f*x + e)/(cos(f*x + e) + 1))/a + 1/(a + a*sin(f*x + e)/(cos(
f*x + e) + 1))) + c^2/(a + a*sin(f*x + e)/(cos(f*x + e) + 1)))/f

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 135 vs. \(2 (62) = 124\).

Time = 0.43 (sec) , antiderivative size = 135, normalized size of antiderivative = 2.25 \[ \int \frac {(c+d \sin (e+f x))^2}{3+3 \sin (e+f x)} \, dx=\frac {\frac {{\left (2 \, c d - d^{2}\right )} {\left (f x + e\right )}}{a} - \frac {2 \, {\left (c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 2 \, c d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + c^{2} - 2 \, c d + 2 \, d^{2}\right )}}{{\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} + \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1\right )} a}}{f} \]

[In]

integrate((c+d*sin(f*x+e))^2/(a+a*sin(f*x+e)),x, algorithm="giac")

[Out]

((2*c*d - d^2)*(f*x + e)/a - 2*(c^2*tan(1/2*f*x + 1/2*e)^2 - 2*c*d*tan(1/2*f*x + 1/2*e)^2 + d^2*tan(1/2*f*x +
1/2*e)^2 + d^2*tan(1/2*f*x + 1/2*e) + c^2 - 2*c*d + 2*d^2)/((tan(1/2*f*x + 1/2*e)^3 + tan(1/2*f*x + 1/2*e)^2 +
 tan(1/2*f*x + 1/2*e) + 1)*a))/f

Mupad [B] (verification not implemented)

Time = 6.97 (sec) , antiderivative size = 124, normalized size of antiderivative = 2.07 \[ \int \frac {(c+d \sin (e+f x))^2}{3+3 \sin (e+f x)} \, dx=-\frac {d^2\,f\,x-2\,c\,d\,f\,x}{a\,f}-\frac {{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2\,\left (2\,c^2-4\,c\,d+2\,d^2\right )-4\,c\,d+2\,c^2+4\,d^2+2\,d^2\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}{f\,\left (a\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^3+a\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2+a\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )+a\right )} \]

[In]

int((c + d*sin(e + f*x))^2/(a + a*sin(e + f*x)),x)

[Out]

- (d^2*f*x - 2*c*d*f*x)/(a*f) - (tan(e/2 + (f*x)/2)^2*(2*c^2 - 4*c*d + 2*d^2) - 4*c*d + 2*c^2 + 4*d^2 + 2*d^2*
tan(e/2 + (f*x)/2))/(f*(a + a*tan(e/2 + (f*x)/2) + a*tan(e/2 + (f*x)/2)^2 + a*tan(e/2 + (f*x)/2)^3))